package com.jiyuntang.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.jiyuntang.form.TAdmin;
import com.jiyuntang.service.LoginAdminManage;

public class LoginAdminAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String forward = null;
		if(request.getSession().getAttribute("userinfo") != null){
			return mapping.findForward("adminindexpage");
		}
		TAdmin admin = (TAdmin)form;
		LoginAdminManage adminManage = new LoginAdminManage();
		forward = adminManage.loginAdmin(admin, request);
		return mapping.findForward(forward);
	}
}
